const CompressionPlugin = require('compression-webpack-plugin');
// const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const prodPlugin=[]
if(process.env.NODE_ENV==='production'){
	prodPlugin.push(new CompressionPlugin({
    filename: '[path].gz[query]',
    algorithm: 'gzip',
    test: /\.js$|\.css$|\.html$/,
    threshold: 6000, // 只有大小大于该值的资源会被处理 10240
    minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
    deleteOriginalAssets: false, // 删除原文件
  }))
}
module.exports = {
  productionSourceMap: false,
  configureWebpack:{
    plugins:[
      ...prodPlugin
    ],
    externals: {
       'vue': 'Vue',
       'vue-router':"VueRouter",
       axios:"axios",
       vuex:"Vuex",
       'echarts':"echarts",
       'element-ui':"ElementUI"
    }
  },
}